/**   
* @Title: SchoolingImpl.java 
* @Package cn.hdmis.dao.imp 
* @Description: TODO
* @author pnwazgx@163.com   
* @date 2011-3-28 下午09:50:32 
* @version V1.0   
*/
package cn.hdmis.dao.impl;

import java.util.Date;
import java.util.List;

import org.hibernate.criterion.Restrictions;

import cn.hdmis.dao.SchoolingDao;
import cn.hdmis.entity.Tuition;
import cn.hdmis.entity.Student;

/** 
 * @ClassName: SchoolingImpl 
 * @Description: TODO
 * @author pnwzgx@163.com
 * @date 2011-3-28 下午09:50:32 
 *  
 */

public class SchoolingDaoImpl extends BaseDaoImp<Tuition> implements	SchoolingDao {

	/* (非 Javadoc) 
	 * <p>Title: findByDate</p> 
	 * <p>Description: </p> 
	 * @param date
	 * @return 
	 * @see cn.hdmis.dao.SchoolingDao#findByDate(java.util.Date) 
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Tuition> findByDate(Date date) {
		// TODO Auto-generated method stub
		return this.getSession().createCriteria(Tuition.class).add(Restrictions.eq("currentDate", date)).list();
	}

	/* (非 Javadoc) 
	 * <p>Title: findByDate</p> 
	 * <p>Description: </p> 
	 * @param begin
	 * @param end
	 * @return 
	 * @see cn.hdmis.dao.SchoolingDao#findByDate(java.util.Date, java.util.Date) 
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Tuition> findByDate(Date begin, Date end) {
		// TODO Auto-generated method stub
		return this.getSession().createCriteria(Tuition.class).add(Restrictions.between("currentDate", begin, end)).list();
	}

	/* (非 Javadoc) 
	 * <p>Title: findByStudentAndDate</p> 
	 * <p>Description: </p> 
	 * @param student
	 * @param begin
	 * @param end
	 * @return 
	 * @see cn.hdmis.dao.SchoolingDao#findByStudentAndDate(cn.hdmis.entity.Student, java.util.Date, java.util.Date) 
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Tuition> findByStudentAndDate(Student student, Date begin,
			Date end) {
		// TODO Auto-generated method stub
		return this.getSession().createCriteria(Tuition.class).add(Restrictions.eq("student", student))
		.add(Restrictions.between("currentDate", begin, end)).list();
	}

}
